const obj = { name: 'zhangsan' };

const p = new Proxy(obj, {
  /**
   *
   * @param {*} target 源对象
   * @param {*} key 检查的属性名
   * @returns 需要返回一个boolean值,来确定属性是否存在,也可以返回undefind,不会抛出错误
   */
  has: (target, key) => {
    console.log(target, key);
    return key in target;
  },
});

console.log('name' in p);
